import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'
import Dish from '../views/Dish.vue'
import Card from '../views/RouterCard.vue'


const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'home',
        redirect: '/dish',
        component: Home,

        // 子路由
        children: [
            {
                path: '/dish',
                name: 'dish',
                component: Dish
            },
            {
                path: '/card',
                name: 'card',
                component: Card
            },
            {
                path: '/table',
                name: 'table',
                component: () => import('../views/Table.vue')
            }
        ]
    },
]

const router = createRouter({
    history: createWebHashHistory(), // 最好使用WebHashHistory方式；如果使用WebHistory会非常麻烦，不建议使用这种方式
    routes
})

export default router
